<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['API接口管理','API接口管控','接口额度配置[用户]']" icon="fa fa-bar-chart" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>接口额度配置[用户]</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module">
									<span class="module_text">用户</span>
									<div class="s_hover_box">
										<select   class="select2"  id="userNameSelect2">
											<option value=''></option>
										</select>
										<div class="s_del_icon" (click)='delUserName()'>x</div>
									</div>
								</div>

								<div class="top_module">
									<span class="module_text">接口</span>
									<div class="s_hover_box">
										<select   class="select2"  id="apiSelect2">
											<option value=''></option>
										</select>
										<div class="s_del_icon" (click)='delapi()'>x</div>
									</div>
								</div>

								<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime($event)" ></table-select-date>
								</div>
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button class="btn btn-primary" (click)="table_add(userLimitModal)">新增</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="tableSearch.searchKey" (change)="table_search()" class="search-input" placeholder="用户，接口，接口标识">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>用户</th>
										<th>接口名称</th>
										<th>接口标识</th>
										<th>并发峰值/小时</th>
										<th>配额上限/天</th>
										<th>已用配额/天</th>
										<th>更新人</th>
										<th>创建时间</th>
										<th>更新时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" >
										<td>{{row.userName}}</td>
										<td>{{row.interfaceName}}</td>
										<td>{{row.interfaceKey}}</td>
										<td>{{row.concurrencyMaxTimes}}</td>
										<td>{{row.callMaxTimes}}</td>
										<td>{{row.callTimes}}</td>
										<td>{{row.updateUser}}</td>
										<td>{{row.createTime}}</td>
										<td>{{row.updateTime}}</td>
										<!-- <td>
											<span *ngIf="row.lockStatus == 0">正常</span>
											<span *ngIf="row.lockStatus == 1">锁定</span>
										</td> -->
										<td>
											<button type="button" (click)="editRow(row,userLimitModal)">编辑</button>
											<button type="button" (click)="delRow(row)">刪除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!--    弹窗-->
	<section bsModal #userLimitModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="modalClose(userLimitModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>     
					<h4 class="modal-title">用户-接口额度配置 - <span *ngIf="formType == 'new'">新增</span><span *ngIf="formType == 'updata'">编辑</span></h4>
				</div>
				<form id="userLimitFrom"  class="form-horizontal" role="form" novalidate="novalidate" [saBootstrapValidator]="validatorOptions">
					<div class="modal-body">
						<div class="row form-horizontal">

							<div class="form-group col-xs-12 s_fix_select2_width s_fix_select2">
								<label class="control-label col-xs-3" for="newPassword">用户<sup>*</sup></label>
								<div class="col-xs-9" >
									<input type="hidden" name="userNameFrom" id="userNameFrom" [(ngModel)]='userLimitFrom.userName'/>
								    <div class="s_hover_box">
										<select   class="select2"  id="userNameSelect2From" [disabled]="formType == 'updata'?true:false">
											<option value=''></option>
										</select>
										<div class="s_del_icon" *ngIf="formType == 'new'" (click)='delUserNameFrom()'>x</div>
									</div>
								</div>
							</div>

							<div class="form-group col-xs-12 s_fix_select2_width s_fix_select2">
								<label class="control-label col-xs-3" for="newPassword">接口<sup>*</sup></label>
								<div class="col-xs-9" >
									<input type="hidden" name="interfaceNameFrom" id="interfaceNameFrom" [(ngModel)]='userLimitFrom.interfaceName'/>
								    <div class="s_hover_box">
										<select   class="select2"  id="apiSelect2From" [disabled]="formType == 'updata'?true:false">
											<option value=''></option>
										</select>
										<div class="s_del_icon" *ngIf="formType == 'new'" (click)='delApiFrom()'>x</div>
									</div>
								</div>
							</div>

							<!-- <div class="form-group col-xs-12 s_fix_select2">
								<label class="blue control-label col-xs-2" for="newPassword">接口标识<sup>*</sup></label>
								<div class="col-xs-10" >
									<input style="width:100%;" name="" id="" [(ngModel)]='userLimitFrom.interfaceName'/>
								</div>
							</div> -->

							<div class="form-group col-xs-12 s_fix_select2">
								<label class="control-label col-xs-3" for="newPassword">配额上限/天<sup>*</sup></label>
								<div class="col-xs-9" >
									<input style="width:100%;" class="form-control" name="callMaxTimes" [(ngModel)]='userLimitFrom.callMaxTimes'/>
								</div>
							</div>

							<div class="form-group col-xs-12 s_fix_select2">
								<label class="control-label col-xs-3" for="newPassword">并发峰值/小时<sup>*</sup></label>
								<div class="col-xs-9" >
									<input style="width:100%;"  class="form-control" name="concurrencyMaxTimes" [(ngModel)]='userLimitFrom.concurrencyMaxTimes'/>
								</div>
							</div>
							
	                   	</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" (click)="modalClose(userLimitModal)">取消</button>
						<button type="button" class="btn btn-primary" (click)="userControlSubmit(userLimitModal)">确认</button>
					</div>
				</form>
			</div>
		</div>
	</section>
	<!--  弹窗end-->
</div>